package com.jxs.android.ges;

import android.content.Context;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;

import com.jxs.android.util.StartHelper;
import com.jxs.android.ges.R;

/**
 * @Author Jiangxs
 * @Date 2011-8-4 下午11:35:38
 * @Des 3D旋转效果参见 PDF_p111
 */
public class LaucherApp extends AbstractActivity implements OnItemClickListener {

	private Context context;

	/**
	 * @Des Activity 的界面入口
	 */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		context = this;
		initTopBar(savedInstanceState, R.layout.bu_main);
		GridView appGridView = (GridView) findViewById(R.id.main_app_gridview);
		appGridView.setAdapter(new LaucherAppAdpter(context));
		appGridView.setOnItemClickListener(this);
	}

	/**
	 * @Des 点击中间的图片的时候处理事件
	 */

	@Override
	public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

		// 工作日志，走访记录，一户一案，通讯录(点击后，有个提示功能开发中的页面就可以)
		// 用户查询，终端查询，欠费查询，系统帮助

		switch (position) {
		case 0:// 工作日志
			StartHelper.startActivity(Work_Log_Page.class);
			break;
		case 1:// 走访记录
			StartHelper.startActivity(Visit_Records_Page.class);
			break;
		case 2:// 一户一案
			StartHelper.startActivity(A_Case_Page.class);
			break;
		case 3:// 通讯录
			StartHelper.startActivity(Address_Book_Page.class);
			break;
		case 4:// 用户查询
			StartHelper.startActivity(Search_Of_User.class);
			break;
		case 5:// 终端查询
			StartHelper.startActivity(Search_Of_Term.class);
			break;
		case 6:// 欠费查询
			StartHelper.startActivity(Search_Of_OweFee.class);
			break;
		case 7:// 帮助
			StartHelper.startActivity(FeatureGuide.class);
			break;
		}

	}

	@Override
	protected void onResume() {
		super.onResume();
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		return onKeyDownListener(keyCode, event);
	}

}